﻿#include "CCube.h"
#include "CTransform3.h"
#include "Seal.h"
#include "CProjection.h"
#include "CLighting.h"
#include "CTexture.h"
#include "CMaterial.h"
#include "plane.h"
// DuGuYinView.h: CDuGuYinView 类的接口

#pragma once


class CDuGuYinView : public CView
{
protected: // 仅从序列化创建
	CDuGuYinView() noexcept;
	DECLARE_DYNCREATE(CDuGuYinView)

		// 特性
public:
	CDuGuYinDoc* GetDocument() const;

	// 操作
public:
	void DrawObject(CDC* pDC);
	void DoubleBuffer(CDC* pDC);//双缓冲
	void InitializeLightingScene(void);//初始化光照环境
	void InitializeTexture(void);
	enum class ProjectionType
	{
		PerspectiveProjection, ObliqueProjection, OrthogonalProjection, ViewTransform1, ViewTransform2
	}m_ProjectionType;//用于菜单控制

	// 重写
public:
	virtual void OnDraw(CDC* pDC);  // 重写以绘制该视图
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);


	// 实现
public:
	virtual ~CDuGuYinView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif
protected:
	CTransform3 transform;
	CCube cube;
	double Alpha, Beta;
	double Phi, Psi;
	double R, d;
	BOOL bPlay;
	BOOL isTexture;
	Seal seal;
	int  nLightNumber;
	CLighting* pLight;
	CMaterial* pMaterial;
	CTexture* pTexture; 
	CTexture Texture[26];
	CPlane plane;
	// 生成的消息映射函数
protected:
	afx_msg void OnFilePrintPreview();
	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnOrthogonalProjection();
	afx_msg void OnObliqueProjection();
	afx_msg void OnPerspectiveProjection();
	afx_msg void OnPitchAdjust();
	afx_msg void OnChangeDirect();
};

#ifndef _DEBUG  // DuGuYinView.cpp 中的调试版本
inline CDuGuYinDoc* CDuGuYinView::GetDocument() const
{
	return reinterpret_cast<CDuGuYinDoc*>(m_pDocument);
}
#endif

